﻿function Case(x, y) {

    //Position de la case
    this.X = x;
    this.Y = y;

    this.jeux = document.getElementById("jeux");
   // this.case = null;

    //Etat si false case non creusé, true case creusé
    this.etat = false;

    this.draw = function () {
        //this.case.style.left = this.X + "px";
        //this.case.style.top = this.Y + "px";
    }

    //Lorsque l'on marche sur une case non creusé
    this.changeEtat = function () {
        if (this.etat == false) {
            var img = document.createElement("img");
            img.src = "images/sols/sol_court.png";
            img.id = "fond_" + this.X + "_" + this.Y;
            img.style.width = "50px";
            img.style.height = "50px";
            img.style.position = "absolute";
            img.style.left = this.X + "px";
            img.style.top = this.Y + "px";
            img.alt = "";
            this.jeux.appendChild(img);
            this.etat = true;
        }

    }

    this.init = function (x, y) {
            this.X = x;
            this.Y = y;
    }

    this.init(this.X, this.Y);

}